package com.trkj.controller.wxy;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.trkj.pojo.ExamPaper;
import com.trkj.pojo.QuestionBank;
import com.trkj.pojo.StaffInformation;
import com.trkj.service.ServiceException;
import com.trkj.service.wxy.AdmissionService;
import com.trkj.service.wxy.AuxiliaryInformationService;
import com.trkj.service.wxy.ExamArrangeService;
import com.trkj.service.wxy.ExamGradeService;
import com.trkj.service.wxy.ExamService;
import com.trkj.service.wxy.ExamSiteService;
import com.trkj.service.wxy.OverviewService;
import com.trkj.service.wxy.QuestionBankService;
import com.trkj.service.wxy.QuestionTypeService;
import com.trkj.vo.ShouYeVo;
import com.trkj.vo.wxy.AdmissionInsertVo;
import com.trkj.vo.wxy.AdmissionPageVo;
import com.trkj.vo.wxy.AuxiliaryInformationPageVo;
import com.trkj.vo.wxy.ExamArrangeInsertVo;
import com.trkj.vo.wxy.ExamArrangePageVo;
import com.trkj.vo.wxy.ExamGradePageVo;
import com.trkj.vo.wxy.ExamPageVo;
import com.trkj.vo.wxy.ExamSitePageVo;
import com.trkj.vo.wxy.MultipleInsertVo;
import com.trkj.vo.wxy.OverviewPageVo;
import com.trkj.vo.wxy.QuestionBankPageVo;
import com.trkj.vo.wxy.QuestionTypePageVo;
import com.trkj.vo.wxy.Result;

@Controller
public class IndexController {
	@Autowired
	private ExamService examService;
	
	@Autowired
	private ExamArrangeService examArrangeService;
	
	@Autowired
	private QuestionBankService questionBankService;
	
	@Autowired
	private ExamSiteService examSiteService;
	
	@Autowired
	private ExamGradeService examGradeService;
	
	@Autowired
	private QuestionTypeService questionTypeService ;
	
	@Autowired
	private AdmissionService admissionService;
	
	@Autowired
	private OverviewService overviewService;
	
	@Autowired
	private AuxiliaryInformationService auxiliaryInformationService;
	
	private String questionType_wxy;

//	主页
	@GetMapping("to_index")
	public String to_one() {
		return "wxyindex";
	}
//	人事
	@GetMapping("to_personnel")
	public String to_two() {
		return "personnel";
	}
//	知识管理
	@GetMapping("to_knowledge")
	public String to_three() {
		return "wxyknowledge";
	}
	//考试
	@GetMapping("to_examination")
	public String to_four() {
		return "wxyexamination";
	}
//	培训管理
	@GetMapping("to_train")
	public String to_five() {
		return "wxytrain";
	}
//	招聘
	@GetMapping("to_recruit")
	public String to_six() {
		return "wxyrecruit";
	}
//	规划
	@GetMapping("to_plan")
	public String to_seven() {
		return "wxyplan";
	}
//	人事
	@GetMapping("to_work_attendance")
	public String to_eight() {
		return "wxywork_attendance";
	}
//	薪资
	@GetMapping("to_salary")
	public String to_nine() {
		return "wxysalary";
	}

	
	//桌面
	@GetMapping("to_card")
	public String to_nines(HttpSession session,Model m) {
		List<ShouYeVo> sy = (List<ShouYeVo>) session.getAttribute("sy");
		m.addAttribute("name", sy.get(0).getStainName());
		m.addAttribute("xb", sy.get(0).getStainSex());
		m.addAttribute("zp", sy.get(0).getStainSrc());
		m.addAttribute("bm", sy.get(0).getDefideName());
		
		Object d = session.getAttribute("gryy");
		m.addAttribute("gryy",d);
		
		Object e = session.getAttribute("jtyy");
		m.addAttribute("jtyy",e);
		
		Object f = session.getAttribute("gskc");
		m.addAttribute("gskc",f);
		
		Object g = session.getAttribute("qtyy");
		m.addAttribute("qtyy",g);
		
		return "wxycalendar";
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	//我的考卷
		@GetMapping("to_wdkj")
		public String toWdkj(){
			return "wxywdkj";
		}
		
		//我的考卷查询所有
		@PostMapping("to_wdkj_findAll")
		@ResponseBody
		public List<ExamPageVo> to_Wdkj( HttpSession session){
			 StaffInformation sf=(StaffInformation) session.getAttribute("staff");
			return examService.queryByExam(sf.getStainId());
			
			
		}
		
		//考试试卷查询所有
		@PostMapping("to_kssj_findAll")
		@ResponseBody
		public Map to_Kssj_findAll(int page,int rows){
			long total = examService.empByPageCount();
			List<ExamPageVo> list = examService.queryByExamArrangeQuestion(page, rows);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		}
			
		//我的考卷模糊查询
		@RequestMapping("wdkj_query")
		@ResponseBody
		public List<ExamPageVo> empListByName(String classSjName){
			return examService.queryByName(classSjName);
			
		}
		
		//考试试卷
		@GetMapping("to_kssj")
		
		public String toKssj(Model m){
			m.addAttribute("list", questionBankService.findAll_quName());
			return "wxykssj";
		}
		
		//新增考试试卷页面
		@RequestMapping("kssj_insert")
		public String toKssj_insert(){
			return "wxykssj_insert";
		}
		
		//考试试卷录入页面编辑保存
		@RequestMapping("kssj_update_sava")
		@ResponseBody
		public Result toKssj_updateSava(ExamPageVo examPageVo){
			try {
				examService.updateSavaExamArrangeQuestion(examPageVo.getEpId(), examPageVo);
				return Result.SUCCESS;
			} catch (ServiceException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return Result.failure(e.getMessage());
			}
			
		}
		
		//新增考试试卷编辑页面
		@RequestMapping("kssj_sjlr")
		public String toKssj_update(Long epId,ExamPageVo examPageVo,Model m) throws ServiceException{
			try {
				m.addAttribute("update_list", examService.updateExamArrangeQuestion(epId, examPageVo));
			} catch (ServiceException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				throw new ServiceException(e);
			}
			return "wxykssj_sjlr";
		}
		
		//新增考试试卷
		@PostMapping("add_kssj_insert")
		@ResponseBody
		public Result addExamPaper(ExamArrangeInsertVo examArrangeInsertVo){
			try {
				
				examService.addExamPaper(examArrangeInsertVo.getExamPaper(), examArrangeInsertVo.getQuestionBank());
				
				return Result.SUCCESS;
			} catch (ServiceException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return Result.failure(e.getMessage());
			}
			
		}
		//考试试卷删除
		@PostMapping("kssj_delete")
		@ResponseBody
		public Result kssj_delete(Long epId){
			try {
				examService.kssj_delete(epId);
				return Result.SUCCESS;
			} catch (ServiceException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return Result.failure(e.getMessage());
			}
				
			}
		//新增考试试卷题库查询所有
		@PostMapping("findAll_questionBank")
		@ResponseBody
		public List<QuestionBank> findAll_questionBank(){
			
			return questionBankService.findAll_quName();
		}
		
		//新增考试试卷题库查询所有分页
		@GetMapping("findAll_questionBank_page")
		@ResponseBody
		public Map questionPage(int page, int rows){
			long total = questionBankService.empByPageCount();
			List<QuestionBank> list = questionBankService.queryByPage(page, rows);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		}
		
		//考试安排页面
		@GetMapping("to_ksap")
		
		public String toKsap(){
			return "wxyksap";
		}
		//考试安排查询所有
		@PostMapping("to_ksap_findAll")
		@ResponseBody
		public Map toKsap_findAll(int page,int rows){
			long total = examArrangeService.empByPageCount();
			List<ExamArrangePageVo> list = examArrangeService.queryByExamArrangeQuestion(page, rows);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		}
		
		//新增考试安排页面
		@RequestMapping("ksap_insert")
		public String toKsap_insert(){
			return "wxyksap_insert";
		}
		@GetMapping("dkka")
		@ResponseBody
		public ExamPaper djajd(Long id){
			return examService.fallonid(id);
		}
		//新增考试试卷
		@PostMapping("add_ksap_insert")
		@ResponseBody
		public Result addExamArrange(ExamArrangeInsertVo examArrangeInsertVo){
			try {
				examArrangeService.addExamArrange(examArrangeInsertVo.getExamPaper(), examArrangeInsertVo.getExamArrange());
					
				return Result.SUCCESS;
			} catch (ServiceException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return Result.failure(e.getMessage());
			}
				
		}
		//新增考试安排考试试卷查询所有
		@PostMapping("findAll_examPaper")
		@ResponseBody
		public List<ExamPaper> findAll_examPaper(){
				
			return examService.findAll_examName();
		}
			
		//新增考试安排考试试卷查询所有分页
		@GetMapping("findAll_examPaper_page")
		@ResponseBody
		public Map examPaperPage(int page, int rows){
			long total = examService.empByPageCount();
			List<ExamPaper> list = examService.queryByPage(page, rows);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		}
		
		//考试安排删除
		@PostMapping("ksap_delete")
		@ResponseBody
		public Result ksap_delete(Long arrangeId){
			try {
				examArrangeService.ksap_delete(arrangeId);
				return Result.SUCCESS;
			} catch (ServiceException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return Result.failure(e.getMessage());
			}
					
		}
		
		
		//新增考试安排编辑页面
		@RequestMapping("ksap_update")
		public String toKsap_update(Long arrangeId,String classSjName,ExamArrangePageVo examArrangePageVo,Model m) throws ServiceException{
			try {
				m.addAttribute("ksap_update", examArrangeService.updateExamArrangeQuestion(arrangeId,classSjName, examArrangePageVo));
			} catch (ServiceException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				throw new ServiceException(e);
			}
			return "wxyksap_update";
		}
		
		//考试安排页面编辑保存
		@RequestMapping("ksap_update_sava")
		@ResponseBody
		public Result toKsap_updateSava(ExamArrangePageVo examArrangePageVo){
			try {
				examArrangeService.updateSavaExamArrangeQuestion(examArrangePageVo.getArrangeId(),examArrangePageVo.getClassSjName(), examArrangePageVo);
				return Result.SUCCESS;
			} catch (ServiceException e) {
				e.printStackTrace();
				return Result.failure(e.getMessage());
			}
				
		}
		
		//考试现场管理
		@GetMapping("to_ksxcgl")
		
		public String toKsxcgl(){
			return "wxyksxcgl";
		}
		
		//考试现场管理查询所有
		@PostMapping("to_ksxcgl_findAll")
		@ResponseBody
		public Map toKsxcgl_findAll(int page,int rows){
			long total = examSiteService.empByPageCount();
			List<ExamSitePageVo> list = examSiteService.queryByExamSiteKsxcgl(page, rows);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		}
		
		//考试现场管理删除
		@PostMapping("ksxcgl_delete")
		@ResponseBody
		public Result ksxcgl_delete(Long siId){
			try {
				examSiteService.ksxcgl_delete(siId);
				return Result.SUCCESS;
			} catch (ServiceException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return Result.failure(e.getMessage());
			}
						
		}
		
		//今日考试
		@GetMapping("to_jrks")
			
		public String toJrks(){
			return "wxyjrks";
		}
		
		//今日考试查询所有
		@PostMapping("to_jrks_findAll")
		@ResponseBody
		public Map toJrks_findAll(int page,int rows){
			long total = examSiteService.empByPageCount();
			List<ExamSitePageVo> list = examSiteService.queryByExamSiteJrks(page, rows);
			list.forEach(System.out::println);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		}
		
		//考卷评分
		@GetMapping("to_kjpf")
		
		public String toKjpf(){
			return "wxykjpf";
		}
		
		//考卷评分查询所有
		@PostMapping("tokjpf_findAll")
		@ResponseBody
		public Map toKjpf_findAll(int page,int rows){
			long total = examGradeService.empByPageCount();
			List<ExamGradePageVo> list = examGradeService.queryByExamArrangeQuestion(page, rows);
			list.forEach(System.out::println);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		}
		//考卷评分管理删除
		@PostMapping("kjpf_delete")
		@ResponseBody
		public Result kjpf_delete(Long grId){
			try {
				examGradeService.kjpf_delete(grId);
				return Result.SUCCESS;
			} catch (ServiceException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return Result.failure(e.getMessage());
			}
						
		}
		//题库
		@GetMapping("to_question")
		
		public String toQuestion(Model m){
			m.addAttribute("defideName", questionBankService.findAll_defideName());
			return "wxyquestion";
		}
		
		//题库查询所有
		@RequestMapping("to_questionBank_findAll")
		@ResponseBody
		public Map questionBank_findAll(int page,int rows) throws ServiceException{
			long total = questionBankService.empByPageCount();
			List<QuestionBankPageVo> list = questionBankService.queryByQuestionPage(page, rows);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		}
		
		//题库删除
		@PostMapping("questionBank_delete")
		@ResponseBody
		public Result QuestionBank_delete(Long quId){
			try {
				questionBankService.QuestionBank_delete(quId);
				return Result.SUCCESS;
			} catch (ServiceException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return Result.failure(e.getMessage());
			}
						
		}
		
		//题库模糊查询
		@GetMapping("questionBank_query")
		@ResponseBody
		public List<QuestionBank> queryByName(String quName){
			return questionBankService.queryByName(quName);
				
		}
		
		//题库新增
		@RequestMapping("to_questionBank_insert")
		@ResponseBody
		public Result questionBank_insert(String quName,String defideName,String quRemark,String quBlockup){
			try {
				questionBankService.questionBank_insert(quName, defideName, quRemark, quBlockup);
				return Result.SUCCESS;
			} catch (ServiceException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return Result.failure(e.getMessage());
			}
		}
		
		
		//单选
		@GetMapping("to_multiple")
		public String toMultiple(Model m,String questionType){
			questionType_wxy=questionType;
			m.addAttribute("multiple", questionBankService.findAll_quName());
			return "wxymultiple";
	
		}
		//单选查询所有
		@RequestMapping("to_multiple_findAll")
		@ResponseBody
		public Map multiple_findAll(int page,int rows,String questionType) throws ServiceException{
			long total = questionTypeService.empByPageCount();
			List<QuestionTypePageVo> list = questionTypeService.queryByQuestionPage(page, rows,questionType_wxy);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
			
		}
		//新增单选页面
		@RequestMapping("to_multiple_insert")
			
		public String toMultiple_insert(){
			return "wxymultiple_insert";
		}
		
		//单选新增
		@RequestMapping("multiple_insert")
		@ResponseBody
		public Result multiple_insert(MultipleInsertVo multipleInsertVo){
			try {
				questionTypeService.addMultipleInsert(multipleInsertVo.getQuestionBank(), multipleInsertVo.getQuestionType());
				return Result.SUCCESS;
			} catch (ServiceException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return Result.failure(e.getMessage());
			}
		}
				
		//单选删除
		@PostMapping("multiple_delete")
		@ResponseBody
		public Result multiple_delete(String testQuestions){
			try {
				questionTypeService.multiple_delete(testQuestions);
				return Result.SUCCESS;
			} catch (ServiceException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return Result.failure(e.getMessage());
			}
							
		}
		//新增单选编辑页面
		@RequestMapping("multiple_update")
		public String toMultiple_update(String testQuestions,QuestionTypePageVo questionTypePageVo,Model m) throws ServiceException{
			try {
				m.addAttribute("multiple_update", questionTypeService.updateMultiple(testQuestions, questionTypePageVo));
			} catch (ServiceException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				throw new ServiceException(e);
			}
			return "wxymultiple_update";
		}
			
		//单选页面编辑保存
		@RequestMapping("multiple_update_sava")
		@ResponseBody
		public Result toMultiple_updateSava(QuestionTypePageVo questionTypePageVo){
			try {
				questionTypeService.updateSavaMultipleSava(questionTypePageVo.getTestQuestions(), questionTypePageVo);
				return Result.SUCCESS;
			} catch (ServiceException e) {
				e.printStackTrace();
				return Result.failure(e.getMessage());
			}
					
		}			
		//多选
		@GetMapping("to_multiple2")
		
		public String toMultiple2(Model m,String questionType){
			questionType_wxy=questionType;
			m.addAttribute("multiple", questionBankService.findAll_quName());
			return "wxymultiple2";
		}
		
		//新增多选页面
		@RequestMapping("to_multiple2_insert")
			
		public String toMultiple2_insert(){
			return "wxymultiple2_insert";
		}
		
		//多选查询所有
		@RequestMapping("to_multiple2_findAll")
		@ResponseBody
		public Map multiple2_findAll(int page,int rows,String questionType) throws ServiceException{
			long total = questionTypeService.empByPageCount();
			List<QuestionTypePageVo> list = questionTypeService.queryByQuestionPage(page, rows,questionType_wxy);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		}
		
		//多选新增
		@RequestMapping("multiple2_insert")
		@ResponseBody
		public Result multiple2_insert(MultipleInsertVo multipleInsertVo){
			try {
				questionTypeService.addMultipleInsert(multipleInsertVo.getQuestionBank(), multipleInsertVo.getQuestionType());
				return Result.SUCCESS;
			} catch (ServiceException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return Result.failure(e.getMessage());
			}
		}
			
		//多选删除
		@PostMapping("multiple2_delete")
		@ResponseBody
		public Result multiple2_delete(String testQuestions){
			try {
				questionTypeService.multiple_delete(testQuestions);
				return Result.SUCCESS;
			} catch (ServiceException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return Result.failure(e.getMessage());
			}
								
		}
		
		//新增多选编辑页面
		@RequestMapping("multiple2_update")
		public String toMultiple2_update(String testQuestions,QuestionTypePageVo questionTypePageVo,Model m) throws ServiceException{
			try {
				m.addAttribute("multiple2_update", questionTypeService.updateMultiple(testQuestions, questionTypePageVo));
			} catch (ServiceException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				throw new ServiceException(e);
			}
			return "wxymultiple2_update";
		}
				
		//多选页面编辑保存
		@RequestMapping("multiple2_update_sava")
		@ResponseBody
		public Result toMultiple2_updateSava(QuestionTypePageVo questionTypePageVo){
			try {
				questionTypeService.updateSavaMultipleSava(questionTypePageVo.getTestQuestions(), questionTypePageVo);
					return Result.SUCCESS;
			} catch (ServiceException e) {
				e.printStackTrace();
				return Result.failure(e.getMessage());
			}
						
		}	
		//判断页面
		@GetMapping("to_judge")
		public String toJudge(Model m,String questionType){
			questionType_wxy=questionType;
			m.addAttribute("multiple", questionBankService.findAll_quName());
			return "wxyjudge";
		}
		
		//新增判断
		@RequestMapping("to_judge_insert")
				
		public String toJudge_insert(){
			return "wxyjudge_insert";
		}
		//判断查询所有
		@RequestMapping("to_judge_findAll")
		@ResponseBody
		public Map judge_findAll(int page,int rows,String questionType) throws ServiceException{
			long total = questionTypeService.empByPageCount();
			List<QuestionTypePageVo> list = questionTypeService.queryByQuestionPage(page, rows,questionType_wxy);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		}
		
		//判断新增
		@RequestMapping("judge_insert")
		@ResponseBody
		public Result judge_insert(MultipleInsertVo multipleInsertVo){
			try {
				questionTypeService.addMultipleInsert(multipleInsertVo.getQuestionBank(), multipleInsertVo.getQuestionType());
				return Result.SUCCESS;
			} catch (ServiceException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return Result.failure(e.getMessage());
			}
		}
			
		//判断删除
		@PostMapping("judge_delete")
		@ResponseBody
		public Result judge_delete(String testQuestions){
			try {
				questionTypeService.multiple_delete(testQuestions);
				return Result.SUCCESS;
			} catch (ServiceException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return Result.failure(e.getMessage());
			}
								
		}
		
		//判断编辑页面
		@RequestMapping("judge_update")
		public String toJudge_update(String testQuestions,QuestionTypePageVo questionTypePageVo,Model m) throws ServiceException{
			try {
				m.addAttribute("judge_update", questionTypeService.updateMultiple(testQuestions, questionTypePageVo));
			} catch (ServiceException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				throw new ServiceException(e);
			}
			return "wxyjudge_update";
		}
				
		//判断页面编辑保存
		@RequestMapping("judge_update_sava")
		@ResponseBody
		public Result toJudge_updateSava(QuestionTypePageVo questionTypePageVo){
			try {
				System.out.println("QuestionController"+questionTypePageVo);
				questionTypeService.updateSavaMultipleSava(questionTypePageVo.getTestQuestions(), questionTypePageVo);
					return Result.SUCCESS;
			} catch (ServiceException e) {
				e.printStackTrace();
				return Result.failure(e.getMessage());
			}
						
		}	
		
		
		
		//填空
		@GetMapping("to_fill")
		
		public String toFill(){
			return "wxyfill";
		}
		
		//新增填空
		@RequestMapping("to_fill_insert")
					
		public String toFill_insert(){
			return "wxyfill_insert";
		}
		
		//综合页面
		@GetMapping("to_synthesize")
		public String toSynthesize(Model m,String questionType){
			questionType_wxy=questionType;
			m.addAttribute("multiple", questionBankService.findAll_quName());
			return "wxysynthesize";
		}
			
		//综合新增页面
		@RequestMapping("to_synthesize_insert")
					
		public String toSynthesize_insert(){
			return "wxysynthesize_insert";
		}
		//综合查询所有
		@RequestMapping("to_synthesize_findAll")
		@ResponseBody
		public Map synthesize_findAll(int page,int rows,String questionType) throws ServiceException{
			long total = questionTypeService.empByPageCount();
			List<QuestionTypePageVo> list = questionTypeService.queryByQuestionPage(page, rows,questionType_wxy);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		}
			
		//综合新增
		@RequestMapping("synthesize_insert")
		@ResponseBody
		public Result synthesize_insert(MultipleInsertVo multipleInsertVo){
			try {
				questionTypeService.addMultipleInsert(multipleInsertVo.getQuestionBank(), multipleInsertVo.getQuestionType());
				return Result.SUCCESS;
			} catch (ServiceException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return Result.failure(e.getMessage());
			}
		}
				
		//综合删除
		@PostMapping("synthesize_delete")
		@ResponseBody
		public Result synthesize_delete(String testQuestions){
			try {
				questionTypeService.multiple_delete(testQuestions);
				return Result.SUCCESS;
			} catch (ServiceException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return Result.failure(e.getMessage());
			}
									
		}
		
		//综合编辑页面
		@RequestMapping("synthesize_update")
		public String toSynthesize_update(String testQuestions,QuestionTypePageVo questionTypePageVo,Model m) throws ServiceException{
			try {
				m.addAttribute("synthesize_update", questionTypeService.updateMultiple(testQuestions, questionTypePageVo));
			} catch (ServiceException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				throw new ServiceException(e);
			}
			return "wxysynthesize_update";
		}
					
		//综合页面编辑保存
		@RequestMapping("synthesize_update_sava")
		@ResponseBody
		public Result toSynthesize_updateSava(QuestionTypePageVo questionTypePageVo){
			try {
				questionTypeService.updateSavaMultipleSava(questionTypePageVo.getTestQuestions(), questionTypePageVo);
				return Result.SUCCESS;
			} catch (ServiceException e) {
				e.printStackTrace();
				return Result.failure(e.getMessage());
			}
						
		}		
		
		//试题列表
		@GetMapping("to_testquestions")
		
		public String toTestquestions(){
			return "wxytestquestions";
		}
		
		//试题列表所有
		@RequestMapping("to_testquestions_findAll")
		@ResponseBody
		public Map testquestions_findAll(int page,int rows) throws ServiceException{
			long total = questionTypeService.empByPageCount();
			List<QuestionTypePageVo> list = questionTypeService.queryByQuestionTypePage(page, rows);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		}
		
		//综合删除
		@PostMapping("testquestions_delete")
		@ResponseBody
		public Result testquestions_delete(String testQuestions){
			try {
				questionTypeService.multiple_delete(testQuestions);
				return Result.SUCCESS;
			} catch (ServiceException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return Result.failure(e.getMessage());
			}
									
		}

		//准考证
		@GetMapping("to_admission")
		
		public String toAdmission(){
			return "wxyadmission";
		}

		//新增准考证
		@RequestMapping("to_admission_insert")
						
		public String toAdmission_insert(Model m){
			m.addAttribute("admDefide", questionBankService.findAll_defideName());
			return "wxyadmission_insert";
		}
		
		//准考证查询所有
		@RequestMapping("to_admission_findAll")
		@ResponseBody
		public Map admission_findAll(int page,int rows) throws ServiceException{
			long total = admissionService.admissionByPageCount();
			List<AdmissionPageVo> list = admissionService.queryByAdmissionPage(page, rows);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		}

		//新增准考证用户查询所有
		@PostMapping("findAll_admission")
		@ResponseBody
		public List<StaffInformation> findAll_admission(){
			
			return admissionService.findAll_staName();
		}
		
		//新增准考证用户查询所有分页
		@GetMapping("findAll_admission_page")
		@ResponseBody
		public Map admission(int page, int rows){
			long total = admissionService.empByPageCount();
			List<StaffInformation> list = admissionService.queryByPage(page, rows);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		}
		
		//准考证新增
		@RequestMapping("admission_insert")
		@ResponseBody
		public Result admission_insert(AdmissionInsertVo admissionInsertVo){
			try {
				admissionService.addAdmission(admissionInsertVo.getAdmission(), admissionInsertVo.getStaffInformation(), admissionInsertVo.getDefinitionDept());
				return Result.SUCCESS;
			} catch (ServiceException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return Result.failure(e.getMessage());
			}
		}
		
		//准考证删除
		@PostMapping("admission_delete")
		@ResponseBody
		public Result admission_delete(Long admId){
			try {
				admissionService.admission_delete(admId);
				return Result.SUCCESS;
			} catch (ServiceException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return Result.failure(e.getMessage());
			}
									
		}

		
		//准考证编辑页面
		@RequestMapping("admission_update")
		public String toAdmission_update(Long admId,AdmissionPageVo admissionPageVo,Model m) throws ServiceException{
			try {
				m.addAttribute("admission_update", admissionService.updateAdmision(admId, admissionPageVo));
				m.addAttribute("admDefideUp", questionBankService.findAll_defideName());
			} catch (ServiceException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				throw new ServiceException(e);
			}
			return "wxyadmission_update";
		}
					
		//准考证页面编辑保存
		@RequestMapping("admission_update_sava")
		@ResponseBody
		public Result toAdmission_updateSava(AdmissionPageVo admissionPageVo){
			try {
				admissionService.updateSavaAdmission(admissionPageVo.getAdmId(), admissionPageVo);
				return Result.SUCCESS;
			} catch (ServiceException e) {
				e.printStackTrace();
				return Result.failure(e.getMessage());
			}
						
		}		

		//错题统计
		@GetMapping("to_mistakes")
		
		public String toMistakes(){
			return "wxymistakes";
		}
		
		//考试安排概览
		@GetMapping("to_examArrangeGanl")
		public String toExamArrangeGanl(Model m){
			return "wxyexamArrangeGanl";
		}
		
		//考试安排概览查询所有
		@RequestMapping("to_examArrangeGanl_findAll")
		@ResponseBody
		public Map examArrangeGanl_findAll(int page,int rows) throws ServiceException{
			long total = overviewService.empByPageCount();
			List<OverviewPageVo> list = overviewService.queryByOverviewPageVo(page, rows);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		}
		
		//考试安排概览查询所有
		@RequestMapping("to_examArrangeGanl2_findAll")
		@ResponseBody
		public Map examArrangeGanl2_findAll(int page,int rows) throws ServiceException{
			long total = overviewService.empByPageCount();
			List<OverviewPageVo> list = overviewService.queryByOverviewPage(page, rows);
			System.out.println(list);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		}
		
		
		//员工成绩概览页面
		@GetMapping("to_staffCjGanl")
		public String toStaffCjGanl(){
			return "wxystaffCjGanl";
		}
		
		//员工成绩概览查询所有
		@RequestMapping("to_staffCjGanl_findAll")
		@ResponseBody
		public Map staffCjGanl_findAll(int page,int rows) throws ServiceException{
			long total = examArrangeService.empByPageCount();
			List<ExamArrangePageVo> list = examArrangeService.queryByStaffCjGanl(page, rows);
			
			System.out.println(list);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		}

		
		//辅助资料
		@GetMapping("to_examAssistData")
		public String toExamAssistData(Model m){
			m.addAttribute("skillName", auxiliaryInformationService.findAll_skillName());
			return "wxyexamAssistData";
		}
		
		//辅助资料查询所有
		@RequestMapping("to_examAssistData_findAll")
		@ResponseBody
		public Map examAssistData_findAll(int page,int rows) throws ServiceException{
			long total = auxiliaryInformationService.empByPageCount();
			List<AuxiliaryInformationPageVo> list = auxiliaryInformationService.queryByAssistDataPage(page, rows);
			Map map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		}

		//辅助资料新增
		@RequestMapping("to_examAssistData_insert")
		@ResponseBody
		public Result examAssistData_insert(String codingName,String skillName,String codingRemark,BigDecimal codingBlockup){
			try {
				auxiliaryInformationService.questionBank_insert(codingName, skillName, codingRemark, codingBlockup);
				System.out.println(codingName+"controller11"+skillName);
				return Result.SUCCESS;
			} catch (ServiceException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return Result.failure(e.getMessage());
			}
		}
		
		//辅助资料删除
		@PostMapping("examAssistData_delete")
		@ResponseBody
		public Result examAssistData_delete(Long codingId){
			try {
				auxiliaryInformationService.AuxiLiary_delete(codingId);
				return Result.SUCCESS;
			} catch (ServiceException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return Result.failure(e.getMessage());
			}
						
		}


	}
